package com.java.simple.study.jvm.memstruct.methodarea;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * @author zhoujunlin
 * @date 2021/12/12
 * @desc StringTable
 **/
public class Demo3_6 {

    public static void main(String[] args) throws IOException {
        List<String> comeOnSword = new ArrayList<>();
        System.in.read();
        for (int i = 0; i < 10; i++) {
            try(BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(
                    Demo3_6.class.getClassLoader().getResourceAsStream("剑来.txt")))){
                String line = null;
                long start = System.currentTimeMillis();
                while (true){
                    line = bufferedReader.readLine();
                    if(line == null){
                        break;
                    }
                    //comeOnSword.add(line);
                    comeOnSword.add(line.intern());
                }
                System.out.println(System.currentTimeMillis() - start);
            }
        }
        System.in.read();
    }
}
